<template>
	<view class="box">
		<view class="list flex a-t" v-for="(item, index) in list">
			<image v-if="item.icon_image" :src="item.icon_image" style="width: 30px; margin-right: 6px; " mode="widthFix"></image>
			<view>
				<view class="f14 c6">{{ item.name }}</view>
				<view class="f12 c6">{{ item.date || '' }}</view>
			</view>
			<view @click="all('./canvas?item=' + JSON.stringify(item))" style="margin-left: auto;" class="flex j-t a-t">
				<view style="line-height: 14px;">
					<view class="f14">
						<text class="bg f16 fb">{{ item.diff_day }}</text>
						天
					</view>
					<view style="text-align: center;"><image src="https://yunkeososyunchuc.bc8t.cn/lianaikongjian/static/bianji1.png" style="width: 10px;" mode="widthFix"></image></view>
				</view>
			</view>
		</view>

		<view
			@click="all('./edit')"
			class="button f14"
			style="width: 120px; text-align: center; line-height: 40px;position: fixed; z-index: 1;bottom: 50px; left: 50%; margin-left: -60px; "
		>
			+新增
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			list: []
		};
	},
	onShow() {
		this.jnr();
	},
	methods: {
		all(e) {
			uni.navigateTo({
				url: e
			});
		},
		async jnr() {
            if(!this.vuex_user_content.id){
                uni.showToast({
                    title: '获取空间信息失败，请重新进入',
                    icon: 'none'
                });
                setTimeout(function () {
                    uni.switchTab({
                        url:'/pages/content/content'
                    })
                }, 1500);
                return false;
            }
			let data = {
				my_space_id: this.vuex_user_content.id
			};
			let res = await this.$u.api.anniversaryList(data);
			this.list = res;
		}
	}
};
</script>

<style>
page {
	background: #fec5ce;
}
.list {
	background: #fff;
	border-radius: 6px;
	padding: 20px 10px;
	margin-bottom: 10px;
}
</style>
